package com.qk.management.mapper;

import com.qk.entity.Course;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface CourseMapper {

    List<Course> page(String name, Integer subject,Integer target);

    @Insert("INSERT INTO course (name, subject, price, target, description, create_time, update_time) " +
        "VALUES (#{name}, #{subject}, #{price}, #{target}, #{description}, #{createTime}, #{updateTime})")
    void insert(Course course);

    @Delete("DELETE FROM course WHERE id = #{id}")
    void delete(Integer ids);

    @Select("SELECT * FROM course WHERE id = #{id}")
    Course select(Integer id);

    void update(Course course);

    @Select("SELECT * FROM course")
    List<Course> selectAll();

    @Select("SELECT * FROM course WHERE subject = #{subject}")
    List<Course> selectBySubject(Integer subject);
}
